import pandas as pd
import os

csv_list = ['./hk_urls/'+i for i in os.listdir('./hk_urls') if i.endswith('.csv')]

hc_stock = pd.read_excel('./stock_list/红筹股清单.xlsx')


stocks = hc_stock['证券代码'].apply(lambda x: '0' + str(x.split('.')[0]))
# print(stocks)

for file in csv_list:
    freq = 'annual' if 'annual' in file else 'interim'
    df = pd.read_csv(file)
    exists = df[(df['股票代码'].isin(stocks))]
    print(freq + str(exists.shape[0]))
    print(exists.head())